Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jobs: templating for email action #1326

Merged
merged 14 commits into from
Sep 9, 2024
Merged

Conversation

despadam
Copy link

@despadam despadam commented Jul 22, 2024

Motivation:

#1152

Description:

The email action is implemented so that it validates all relevant values provided in the configuration file, inside the constructor. When performing the action, the email body is read from a template file, the path for which is provided in the configuration. We then fill in the values in the template with the respective job-specific information.

Please note that this is a first and basic implementation of the email action, which acts as a proof of concept for the Jobs MVP. The mailer (i.e. SMTP) is not property set up, so in the end we never actually send the email. Instead, we only perform validation and templating, and print the result of what the email content would look like, in the console.

Changes:

  • In jobConfig.example.json: included configuration for the email action. It is possible that this is not the final schema, especially when it comes to providing the value for password. TBD as it is dependent on how the mailer service is set up in the facility. Please note the assumption that bodyTemplate should be the path to the template file.
  • job-template-simplified.html is a minimal template example that requires only some basic job information. To be expanded.
  • emailaction.ts: based on previous changes in the Action class, all validation is performed inside the constructor. Setting up mailService is commented out as we are currently not actually making the connection to the service. We open and read the file for which the path is provided in bodyTemplate. We fill in the template with the job details. Only the necessary fields are exposed to the template via jobTemplateOptions. In the end, instead of sending an actual email, we print the result in the console.
  • jobs.controller.ts: applied a fix in order to always correctly provide to the template a list of datasetIds inside jobParams.

@despadam despadam marked this pull request as ready for review August 9, 2024 23:41
@despadam despadam requested a review from sbliven September 6, 2024 09:04
Copy link
Contributor

@sbliven sbliven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine with the understanding that the SMTP part is a stub. For instance, in the real thing the user/password should not come from jobConfig.json but from environmental variables. We will need a GraphQL implementation too for MS365 emails.

src/jobs/actions/emailaction.ts Outdated Show resolved Hide resolved
@despadam despadam changed the title Jobs: implement email action Jobs: templating for email action Sep 9, 2024
@despadam despadam merged commit 6b56931 into release-jobs Sep 9, 2024
7 checks passed
@despadam despadam deleted the 1152-emailjobaction branch September 9, 2024 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants